<template>
	<view class="page" style="height:100vh;background: #ededed;">
		<free-nav-bar showback :showright="false" title="群聊列表">


		</free-nav-bar>
		<free-list-item v-for="item in row" showright
		@click="agree(item)"
			:cover="item.avatar? item.avatar:'/static/images/mail/friend.png'" :title="item.name">
		</free-list-item>
	</view>
</template>

<script>
	import freeNavBar from "@/components/free-ui/free-nav-bar.vue"
	import freeListItem from "@/components/free-ui/free-list-item.vue"
	
	import {
		mapState
	} from "vuex"
	import $H from '../../../utils/request.js';
	export default {
		components: {
			freeNavBar,
			freeListItem
		},
		data() {
			return {
				row:[],
				form: {
					friend_id: 0,
					nickname: "",
					lookme: false,
					lookhim: false,

				}
			}
		},
		onShow() {
			this.getlist()
				},
		computed: {
		},
		methods: {
			getlist(){
				$H.post("group/list").then(res=>{
					console.log(res,"res");
					this.row=res
				})
			},
			agree(e){
				uni.navigateTo({
					url:"/pages/chat/chat?type=group&&params="+encodeURIComponent(JSON.stringify(e)) 
				})
			}
		}
	}
</script>

<style>

</style>
